#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<stdlib.h>

const int num = 10;

void Worker(){
  int cnt = 12;
  while(cnt)
  {
    printf("child %d is running ,cnt: %d\n",getgid(),cnt);
    cnt --;
    sleep(1);
  }
}

int main(){
  for(int i =0;i<num;i++){
    pid_t id = fork();
    if(id<0) break;
    if(id == 0)
    {
      Worker();
      exit(0);  
    }
    printf("father create child ,child's PID is %d\n",id);
    sleep(1);
  }
  
    sleep(10);
    return 0;
}
